namespace org.jawk.jrt
{
	/// <summary>Implement the KeyList interface with an ArrayList.</summary>
	/// <remarks>Implement the KeyList interface with an ArrayList.</remarks>
	public class KeyListImpl : org.jawk.jrt.IKeyList
	{
		private System.Collections.Generic.IList<object> list;

		/// <summary>Convert the set to a KeyList.</summary>
		/// <remarks>
		/// Convert the set to a KeyList.
		/// We could have used an ArrayList directly.  However, tagging
		/// the implementation with a KeyList interface improves type
		/// checking within the parsing / semantic analysis phase.
		/// </remarks>
		public KeyListImpl(System.Collections.Generic.ICollection<object> set)
		{
			//public class KeyListImpl extends ArrayList<Object> implements KeyList
			//super(set);
			list = new System.Collections.Generic.List<object>(set);
		}

		public object GetFirstAndRemove()
		{
            object o = list[0];
            list.RemoveAt(0);
            return o;
		}

		public virtual int Size()
		{
			return list.Count;
		}
	}
}
